package com.iasku.manager;

import java.util.ArrayList;

import android.app.Activity;

public class ExitManager {
    private static ExitManager manager;
    private ArrayList<Activity> mActivitys;
    
    private ExitManager(){
        this.mActivitys = new ArrayList<Activity>();
    }
    
    public static ExitManager getExitManager(){
        if(manager == null){
            manager = new ExitManager();
        }
        return manager;
    }
    
    public void addActivity(Activity activity){
        this.mActivitys.add(activity);
    }
    
    public void exitActivities(){
        if(!this.mActivitys.isEmpty()) {
            for(int i = 0; i < mActivitys.size(); i++){
                mActivitys.get(i).finish();
            }
            mActivitys.clear();
        }
    }
}
